home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr13 / aurora2c.zip / DRAWBOX.AML < prev    next >
Text File  |  1995-04-07  |  3KB  |  116 lines

  1.  
  2. // ───────────────────────────────────────────────────────────────────
  3. // The Aurora Editor v2.0
  4. // Copyright 1993-1995 nuText Systems. All Rights Reserved Worldwide.
  5. //
  6. // Draw a box around a column mark
  7. //
  8. // This macro draws a box around a column mark in the current window.
  9. // The box style can be passed to this macro, or if nothing is passed,
  10. // the user is prompted for the box style. The following box styles
  11. // are available:
  12. //
  13. //   1 - single line
  14. //   2 - double horizontal line
  15. //   3 - double vertical line
  16. //   4 - double horizontal and vertical line
  17. //   5 - spaces
  18. //   6 - shaded characters
  19. //
  20. // ───────────────────────────────────────────────────────────────────
  21.  
  22.   // compile time macros and function definitions
  23.   include  bootpath "define.aml"
  24.  
  25.   // test for edit windows
  26.   if not wintype? "edit" then
  27.     msgbox "Edit windows only!"
  28.     return
  29.   end
  30.  
  31.   // test for mark in current window and column mark
  32.   if getcurrbuf <> getmarkbuf or getmarktype <> 'k' then
  33.     msgbox "Column block not marked in current window"
  34.     return
  35.   end
  36.  
  37.   // get box style based on first argument (arg 2) passed to this
  38.   // macro (arg 1 is the macro filename)
  39.   boxstyle = arg 2
  40.  
  41.   // if nothing is passed, then prompt the user
  42.   if not boxstyle then
  43.  
  44.     // create a boxstyle menu
  45.     menu "boxstyle"
  46.       item " &Single"               1
  47.       item " Double &Horizontal"    2
  48.       item " Double &Vertical"      3
  49.       item " &Double"               4
  50.       item " &Eraser"               5
  51.       item " Shaded &Character"     6
  52.     end
  53.  
  54.     // display the popup menu and get the boxstyle
  55.     boxstyle = popup "boxstyle" "Select the box style:" 35
  56.  
  57.     // destroy the menu
  58.     destroybuf "boxstyle"
  59.  
  60.     // exit macro if no box style is selected
  61.     if not boxstyle then
  62.       return
  63.     end
  64.  
  65.   end
  66.  
  67.   // get the box style character string
  68.   style = "─│┌┐┘└═│╒╕╛╘─║╓╖╜╙═║╔╗╝╚      ▒▒▒▒▒▒" [(boxstyle - 1) * 6 + 1 : 6]
  69.  
  70.   topside = getmarktop
  71.   botside = getmarkbot
  72.   leftside = getmarkleft
  73.   rightside = getmarkright
  74.  
  75.   undobegin
  76.   usemark 'T'
  77.  
  78.   // right side
  79.   column = rightside + 1
  80.   markcolumn  column column topside botside
  81.   fillblock  style [2]
  82.  
  83.   // left side
  84.   if leftside > 1 then
  85.     column = leftside - 1
  86.     markcolumn  column column topside botside
  87.     fillblock  style [2]
  88.     left_ok = 1
  89.   end
  90.  
  91.   destroymark
  92.   usemark
  93.  
  94.   // top side
  95.   if topside > 1 then
  96.     topside = topside - 1
  97.     ovltext (copystr style [1] (getmarkcols)) leftside topside
  98.     ovltext style [4]  rightside + 1  topside
  99.     if left_ok then
  100.       ovltext style [3]  leftside - 1  topside
  101.     end
  102.   end
  103.  
  104.   // bottom side
  105.   if botside < getlines then
  106.     botside = botside + 1
  107.     ovltext (copystr style [1] (getmarkcols)) leftside botside
  108.     ovltext style [5]  rightside + 1  botside
  109.     if left_ok then
  110.       ovltext style [6]  leftside - 1  botside
  111.     end
  112.   end
  113.  
  114.   undoend
  115.  
  116.